<template>
  <z-paging ref="paging"  v-model="bannerList" @query="queryList" bg-color='#F7F9FA'>
	<view class="">
		<!--轮播图-->
<!--		    <u-swiper-->
<!--         height="200"-->
<!--				:list="bannerList"-->
<!--		    ></u-swiper>-->
		<view class="content1">
			
			<!--宫格菜单按钮-->
<!--			 <view class="title fz16 fw" v-if="financeFlag">月成交榜</view>-->
			
			<!--消息滚动栏-->
<!--		  <view class="notice" v-if="financeFlag">-->
<!--				<image class="noticePic" :src="imguser+'/minis/home/notice.png'"  mode=""></image>-->
<!--				<u-notice-bar :text="rollList" direction="column"  bg-color='#fff' color='#FA4538' @click="click"></u-notice-bar>-->
<!--			</view>-->
			
<!--			<view class="rankList" v-if="financeFlag">-->
<!--				<view class="listBar disb aic" v-for="item,index in successList" :key="item.id">-->
<!--					<view class="top">{{index + 1}}.</view>-->
<!--					<view class="fl1 disb aic">-->
<!--						<view class="disp aic">-->
<!--							<image class="userImage" :src="item.userImg" mode=""></image>-->
<!--							<text class="">{{item.name}}</text>-->
<!--						</view>-->
<!--						<text>{{item.title}}</text>-->
<!--					</view>-->
<!--				</view>-->
<!--			</view>-->
			
			
			<!--宫格菜单按钮-->
			 <view class="title disb aic" v-if="financeFlag">
				<text class="fw fz16">推荐业务员</text>
				<text @click="toSales">更多></text>
			</view>


      <view class="salesman" v-if="financeFlag">
        <view class="salesmanBar disp" v-for="(item,index) in salesmanList" :key="index" @click="toSalesmanDetail(item.id)">
          <image class="salesmanImage" :src="item.avatar" mode=""></image>
          <view class="right disc jsb fl1">
            <text class="fw">{{item.name}}</text>
            <view class="disp d-left" >
              <view class="tagList fz10 colorf" v-for="value,index in item.customLabel" :key="index">{{value}}</view>
            </view>
            <text class="fz12">{{item.remark?item.remark:'暂无简介'}}</text>
          </view>
        </view>
      </view>




      <!--宫格菜单按钮-->
      <view class="zxStyle">
			<view class="title fw fz16" @click="click">最新资讯</view>
			
			<view class="newList" v-for="item in newsList" :key="item.id" @click="toInformation(item.id)">
					
				<view class="disb aic">
					<view class="left fl1 disc jsb">
						<view class="fw">{{transitionStr(item.title)}}</view>
						
						<view class="fz10 color9">{{getTime(item.releaseTime)}}</view>
					</view>
					<image class="newsPic" :src="item.newsImg" mode=""></image>
				</view>
			</view>
      </view>
			
			<u-gap height="5px"></u-gap>
		</view>
	</view></z-paging>
</template>

<script>
import config from '@/common/config'
import {getCheck} from "../../api/login";
	export default {
		props:{
			bannerList:{
				type:Array,
				default:()=>{ return [] }
			},
			rollList:{
				type:Array,
				default:()=>{ return [] }
			},
			successList:{
				type:Array,
				default:()=>{ return [] }
			},
			salesmanList:{
				type:Array,
				default:()=>{ return [] }
			},
			newsList:{
				type:Array,
				default:()=>{ return [] }
			},
      financeFlag:{
        type:Boolean,
        default:()=>{ return false }
      }
		},
		data(){
			return{
        imguser:config.baseImgUrl,
				moreStatus: 'nomore',
				icon:false,
			}
		},
		onLoad() {
		},
		methods:{
			click(){
				
			},
      transitionStr(str){
        var n = 45
        if(str && str.length > n) {
          str = str.substring(0, n) + '...';
        }
        return str;
      },
			//时间戳转换
			getTime(time){
				var oDate = new Date(time),
				oYear = oDate.getFullYear(),
				oMonth = oDate.getMonth() + 1<10?(oDate.getMonth() + 1):oDate.getMonth() + 1,
				oDay = oDate.getDate()<10?(oDate.getDate()):oDate.getDate(),
				oTime = oYear + '年' + oMonth + '月' + oDay + '日'; //最后拼接时间
				return oTime
			},
			queryList() {
			
			},
       getCheckFlag(){
         getCheck().then(res => {
           this.financeFlag = res.data
         })
      },
			//去详情
			toDetail(){
				uni.navigateTo({
					url:"/pages/index/loanRankDetail"
				})
			},
			//去业务员列表
			toSales(){
				uni.navigateTo({
					url:"/pages/index/salesmanList"
				})
			},
			//去业务员详情
			toSalesmanDetail(id){
				uni.navigateTo({
					url:`/pages/index/salesmanDetail?id=${id}`
				})
			},
			//去资讯详情
			toInformation(id){
				uni.navigateTo({
					url:`/pages/index/informationDetail?id=${id}`
				})
			},
			//去通知列表
			toMessage(){
				uni.navigateTo({
					url:"/pages/index/messageList"
				})
			}
		}
	}
</script>

<style lang="scss">
.grid-title {
  line-height: 50rpx;
  font-size: 26rpx;
}
.title{
	padding: 20rpx 0;
}
.notice{
	position: relative;
	.noticePic{
		width: 50rpx;
		height: 50rpx;
		position: absolute;
		top: 12rpx;
		left: 15rpx;
		z-index: 999;
	}
}
.rankList{
	padding: 20rpx;
	margin: 20rpx 0;
	border-radius: 10rpx;
	background-color: #fff;
	.listBar{
		padding: 20rpx 0;
		.top{
			margin-right: 10rpx;
		}
		.userImage{
			width: 50rpx;
			height: 50rpx;
			border-radius: 50%;
			margin-right: 10rpx;
		}
	}
}
.salesman{
	padding: 20rpx 0;
	background-color: #fff;
	.salesmanBar{
		padding: 20rpx;
		.salesmanImage{
			width: 130rpx;
			height: 130rpx;
			border-radius: 10rpx;
			margin-right: 30rpx;
		}
		.right{
			//height: 130rpx;
			.tagList{
				padding: 4rpx 6rpx;
				border-radius: 8rpx;
				margin: 0 4rpx;
				color: #323CDD;
				background-color: #EFEFFD;
			}
		}
	}
}
.newList{
	margin: 10rpx 0;
	padding: 20rpx;
	background-color: #fff;
	border-radius: 10rpx;
	.left{
		height: 160rpx;
		.nav{
			height: 65rpx;
			overflow:hidden; 
			text-overflow:ellipsis;
			display:-webkit-box; 
			-webkit-box-orient:vertical;
			-webkit-line-clamp:2; 
		}
	}
	.newsPic{
		width: 160rpx;
		height: 160rpx;
		border-radius: 10rpx;
		margin-left: 20rpx;
	}
}
.content1{
	padding: 0 20rpx;
}
.d-left{
  margin-left: -10rpx;
}
.zxStyle{
  margin-bottom: 30%
}
</style>